import React from "react";
import { connect } from "react-redux";
import { loadShowDataAysnc } from "@/components/main/index/actionCreator"
import { Showone, Showtwo,Showthree } from "@/components/main/show/styled"
class Show extends React.Component {
    constructor() {
        super();
        this.state = {
            acbde: ""
        }
    }
    render() {
        // console.log(this.props.showlistdata.toJS());
        //第一条数据
        var first = this.props.showlistdata.toJS().share_data;
        var firstOne = [];
        for (var a in first) {
            firstOne.push(first[a]);
        };
        //第二条
        var second = this.props.showlistdata.toJS().static_data;
        var secondTwo = [];
        for (var b in second) {
            secondTwo.push(second[b]);
        };
        //第三条
        // console.log(this.props.showlistdata.toJS().static_data);
        return (

            <div className="test">
                <Showone>
                    <h2>
                        <span>&lt;</span>
                        演出详情
                </h2>

                    <img src={firstOne[2]} alt={firstOne[0]} />

                    <p className="wen">{firstOne[0]}</p>
                    <p className="jia">￥{secondTwo[3]}</p>
                </Showone>
                <Showthree>
                    <p className="wan">演出介绍</p>
                   <div className="abc"></div>
                </Showthree>
                <Showtwo>
                    <div className="kefu">
                        <p className="ke">客服</p>
                        <div className="buy">选座购买</div>
                    </div>
                </Showtwo>
            </div>
        );
    }
    componentDidMount() {
        this.props.loadShowDataAysnc.bind(this)();

        setTimeout(() => {
            var str = this.props.showlistdata.toJS().static_data.show_desc.desc;
            var abc = document.querySelector(".abc");
            abc.innerHTML = str;
            // var arr = document.querySelectorAll(".abc img");
            // var host = "https://image.juooo.com"
            // for (var i = 0; i < arr.length; i++) {
            //     if (arr[i].src.indexOf("image.juooo.com")) {
            //         return;
            //     } else {
            //         var orisrc = arr[i].src.slice(5);
            //         var imgsrc = host + orisrc;
            //         arr[i].src = imgsrc;
            //     }
            // };
            console.log(this.props.showlistdata.toJS());
            var abcdes = this.props.showlistdata.toJS().static_data.venue;
            var avxhd = [];
            for(var d in abcdes){
                avxhd.push(abcdes[d])
            }
        }, 1000)
    }
}
const mapStateToProps = state => {
    return {
        currentCity: state.getIn(["indexReducer", "currentCity"]),
        showlistdata: state.getIn(["indexReducer", "showlistdata"]),
    }
};
const mapDispatchToProps = dispatch => {
    return {
        loadShowDataAysnc() {
            loadShowDataAysnc(dispatch, {
                schedular_id: this.props.showlistdata.schedular_id

            })
        }
    }
};
export default connect(mapStateToProps, mapDispatchToProps)(Show);
